<% layout('/layouts/default.html', {title: '在线用户', libs: ['dataGrid']}){ %>
<div class="card bd-0">
    <div class="card-header d-flex align-items-start justify-content-between box-header">
      <div class="pt-1">在线用户</div>
      <div class="d-flex">
          <button type="button" id="btnSearch" title="查询" class="btn btn-xs btn-default"><i  class="fa fa-filter"></i>查询</button>
      </div>
    </div>
    <div class="card-body pd-10">
      <#form:form id="searchForm" action="${ctx}/state/online/listData" method="post"  class="form-horizontal"
				data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
        <div class="form-group">
          <div class="input-group wd-250">
            <div class="input-group-prepend">
              <span class="input-group-text">登录名称</span>
            </div>
            <#form:input name="username" class="form-control" />
          </div>
        </div>
        <div class="form-group">
          <button type="submit" class="btn btn-primary btn-sm">查询</button>
          <button type="reset" class="btn btn-default btn-sm">重置</button>
        </div>
      </#form:form>
      <table id="dataGrid"></table>
    </div>
  </div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'用户名称', name:'username', index:'create_by_name', width:100, align:"center", formatter: function(val, obj, row, act){
			return '<span title="账号：'+(row.username||'')+'">'+(row.nickname||row.username||'游客');
		}},
		{header:'创建时间', name:'startTimestamp', width:100, align:'center'},
		{header:'最后访问', name:'lastAccessTime', width:100, align:'center'},
		{header:'超时时间', name:'timeout', width:100, align:'center'},
		{header:'客户主机', name:'host', width:70, align:'center'},
		{header:'用户类型', name:'userType', width:50, align:'center', formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_user_type')}, val, '未知', true);
		}},
		{header:'设备名称', name:'deviceName', width:100}
		,{header:'操作', name:'actions', width:50, sortable:false, formatter: function(val, obj, row, act){
			var actions = [];
			actions.push('<a href="${ctx}/state/online/tickOut?sessionId='+row.id+'" class="btnList" title="踢出在线用户" data-confirm="确认要踢出该用户在线状态吗？"><i class="la la-trash"></i></a>&nbsp;');
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>
</body></html>